<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改员工密码</title>
<%@ include file="/web/header.jsp"%>
</head>
<body>
<fieldset class="layui-elem-field" style="margin: 10px">
		<legend >员工</legend>
		<div class="layui-field-box">
			<form class="layui-form layui-form-pane" lay-filter="formA">
				<div class="layui-form-item">
					<label class="layui-form-label">员工编号</label>
					<div class="layui-input-inline">
						<input type="text" name="code" required lay-verify="required" readonly="readonly"
							autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">密码</label>
					<div class="layui-input-inline">
						<input type="text" name="oldpass" placeholder="请输入旧密码" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">新密码</label>
					<div class="layui-input-inline">
						<input type="text" name="newpass1" placeholder="请输入新密码" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">确认密码</label>
					<div class="layui-input-inline">
						<input type="text" name="newpass2" placeholder="请确认新密码" autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<input type="button" value="保存" class="layui-btn" lay-submit lay-filter="updOfPass"> 
						<input type="reset" value="重置" class="layui-btn " >
						<input type="button" value="关闭" class="layui-btn" onclick="layerClose()">
					</div>
				</div>
				<input type="hidden" name="action" value="updOfPass">
			</form>
		</div>
	</fieldset>
	<script type="text/javascript">
		var code = '<%=request.getParameter("code")%>';
		function init() {
			ajax("/EmployeeServlet", { code : code , action : "get" }, "json", function(data) {
				form.val('formA',data);
			})
		}
		init();
		
		formSubmit("updOfPass", "/EmployeeServlet", "text", function(data) {
			console.log(data)
			if (data == 1) {
				layer.msg("修改成功", {time : 1000}, layerClose)
			} else if (data == 2) {
				layer.msg("修改失败，新密码输入不一样")
			} else {
				layer.msg("修改失败,旧密码输入错误")
			}
		});
	</script>
</body>
</html>